package com.wzy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@SpringBootApplication
@EnableScheduling
public class SpringCloudConfigClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudConfigClientApplication.class, args);
    }

    @Autowired
    private ContextRefresher contextRefresher;

    /**
     * 手动刷新配置
     */
    @Scheduled(fixedRate = 3000L, initialDelay = 3000L)
    public void refreshProperties(){
        contextRefresher.refresh();
    }

}
